package cn.jjxx.modules.sys.service.impl;

import cn.jjxx.core.common.service.impl.CommonServiceImpl;
import cn.jjxx.modules.sys.entity.Dict;
import cn.jjxx.modules.sys.mapper.DictMapper;
import cn.jjxx.modules.sys.service.IDictService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service("dictService")
public class DictServiceImpl extends CommonServiceImpl<DictMapper, Dict> implements IDictService {

	@Override
	public List<Dict> selectDictList() {
		return baseMapper.selectDictList();
	}

	@Override
	public List<Dict> selectDictByGroup(String gcode) {
		return baseMapper.selectDictByGroup(gcode);
	}

	@Override
	public Map<String, String> getDictMap(String gcode) {
		List<Dict> list = baseMapper.selectDictByGroup(gcode);
		Map<String,String> map = new HashMap<String, String>();
		for(Dict d:list){
			map.put(d.getValue(), d.getLabel());
		}
		return map;
	}
	
	

}
